package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.model.product.BaseCategory2;
import com.atguigu.gmall.product.mapper.BaseCategory2Mapper;
import com.atguigu.gmall.product.service.BaseCategory2Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 二级分类service层实现类
 */
@Service
public class BaseCategory2ServiceImpl implements BaseCategory2Service {

    @Autowired
    private BaseCategory2Mapper baseCategory2Mapper;

    /**
     * 查询二级分类所有数据
     *
     * @return
     */
    @Override
    public List<BaseCategory2> listByCategory1Id(Long category1Id) {
        return baseCategory2Mapper.
                selectList(new LambdaQueryWrapper<BaseCategory2>()
                        .eq(BaseCategory2::getCategory1Id, category1Id));
    }
}
